package grosso;

import grosso.thread.Consumer;
import grosso.thread.Modifier;
import grosso.thread.Producer;
import util.Main;
import util.Table;

public class MainGrosso extends Main {
	
	private static final String FILE_NAME = "resultGrosso.txt";
	
	public static void main(String[] args) throws InterruptedException {
		MainGrosso main = new MainGrosso();
		
		int sizeOfTable = Integer.parseInt(args[0]);
		int numberOfThreads = Integer.parseInt(args[1]);
		
		Double modifyThreadsPerc = Double.parseDouble(args[2]);
		
		double modifyThreadsPercentage = modifyThreadsPerc / 100;
		
		main.runExperiment(sizeOfTable, numberOfThreads, modifyThreadsPercentage);
	}


	@Override
	public Thread createConsumerThread(Table table,
			int numberOfInterations) {
		return new Thread(new Consumer(table, numberOfInterations));
	}
	
	@Override
	public Thread createProducerThread(Table table,	int numberOfInterations) {
		return new Thread(new Producer(table, numberOfInterations));
	}

	@Override
	public Thread createModifierThread(Table table,	int numberOfInterations) {
		return new Thread(new Modifier(table, numberOfInterations));
	}

	@Override
	protected String getFileName() {
		return FILE_NAME;
	}
}
